const newsData = require('../data/news');

exports.renderNewsDetail = (req, res) => {
  const newsItem = newsData.find(item => item.id === req.params.id);
  if (!newsItem) {
    return res.status(404).send('未找到该新闻');
  }
  
  const seo = {
    title: newsItem.title
  }
  res.render('news', { seo, news: newsItem });
};